package weaver.interfaces.cetc.action;

import com.weaver.general.BaseBean;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.cetc.action.util.WebServiceUtil;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;

/**
 * @Title: ecology-9-demo
 * @Company: 泛微软件
 * @author: weaver.Dusongsong
 * @version: 1.0
 * @CreateDate: 2021-10-28
 * @Description: 合格供方资格认定表流程
 * @ModifyLog:
 **/
/*
 *@Description: 流程提交后调用调用浪潮--更新生产商信息接口
 *@Param:
 *@return:
 *@Author: Dusongsong
 *@Date: 2020/12/10
 */
public class WeaHgghzgrdbAction extends BaseBean implements Action {
    @Override
    public String execute(RequestInfo requestInfo) {
        RecordSet rs = new RecordSet();
        BaseBean baseBean = new BaseBean();
        baseBean.writeLog( "-----WeaHgghzgrdbAction-----" );
        String requestid = requestInfo.getRequestid();
        String tablename = requestInfo.getRequestManager().getBillTableName();//主表
        try {
            String sql = "select gysbh,sqr,sqsj,gysbs,df9,glzdbsp from " + tablename + " where requestid=?";
            rs.executeQuery( sql, requestid );
            rs.next();
            String vendorCode = Util.null2String( rs.getString( "gysbh" ) );//供应商编号
            if(!"".equals( vendorCode )){
                String score =  Util.null2String( rs.getString( "df9" ) );//分数
                String modifier =  Util.null2String( rs.getString( "sqr" ) );//修改人
                String mofifyTime =  Util.null2String( rs.getString( "sqsj" ) ).replace( "-","." );//修改时间
                String vendorIdentify = "";//供应商标识
                String glzdbsp =  Util.null2String( rs.getString( "glzdbsp" ) );
                if("0".equals( glzdbsp )){
                    vendorIdentify = "2";
                }
                if("1".equals( glzdbsp )){
                    vendorIdentify = "3";
                }
                if("2".equals( glzdbsp )){
                    vendorIdentify = "1";
                }
                String result = WebServiceUtil.updateHggf( vendorCode, score, modifier, mofifyTime, vendorIdentify );
                baseBean.writeLog( "result=" + result.toString() );
            }
            return Action.SUCCESS;
        } catch (Exception e) {
            e.printStackTrace();
            writeLog( "异常参考:" + e );
            requestInfo.getRequestManager().setMessageid( "111111" );
            requestInfo.getRequestManager().setMessagecontent( "Action接口异常！" );
            return Action.FAILURE_AND_CONTINUE;
        }
    }
}
